home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / os2 / srefv112.zip / MACROEYE.CMD < prev    next >
OS/2 REXX Batch file  |  1996-05-08  |  3KB  |  102 lines

  1. /* SRE-FILTER "macrospace monitor".
  2. This utility will monitor REXX macrospace, and update 
  3. the SRE-FILTER "input file cache" when it detects that one of the
  4. input files (i.e.; INITFILT, Replacement strings, Virtual directories)
  5. has changed.  It should be run concurrently with SRE-FILTER --
  6. you should START it after, or just before, you start Go-serve.
  7. Actually, you should start it AFTER the first hit to SRE-FILTER 
  8. (since SRE-FILTER loads stuff up when it's first hit, but not
  9. afterwards).
  10.  
  11. You can give two  arguments:
  12.   1 -- SleepSec  : the number of seconds to wait before rechecking
  13.        The  deafult is 60
  14.   2 -- maxseconds : the number of seconds to wait for SRE-FILTER to
  15.        become activated.  If this program is started before SRE-FILTER
  16.        is activated (that is, before the first hit to SRE-FILTER),
  17.        it will wait maxseconds for such an activation.  If none occurs,
  18.        it will exit.
  19.  
  20.        The defaut is 300.
  21.  
  22. Caution: You should close down the process running this program after
  23. closing GoServer (it does NOT detect that GoServe has been stopped).
  24. Failure to do this may effect proper function of GoServe (say, if you
  25. immediately restart GoServe).
  26.  
  27.  */
  28.  
  29. /* Load up advanced REXX functions */
  30. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  31. call SysLoadFuncs
  32.  
  33.  
  34. parse arg sleepsec maxseconds
  35. typlist='REPSTRGS INITFILT USER ALIAS INTERPRET VIRTUAL ACCESS '
  36.  
  37. if sleepsec="" then sleepsec=60
  38. if maxseconds="" then maxseconds=300
  39.  
  40. say " Sleep seconds= " sleepsec " , seconds to wait for sref_ loading " maxseconds
  41.  
  42. maxiters=(maxseconds/sleepsec)
  43. if maxiters=0 then maxiters=1
  44.  
  45. iters=0
  46.  
  47. tryme1:         /* jump here if no sref_ functions */
  48. iters=iters+1
  49. if iters>maxiters then do
  50.   say " Timed out waiting for sref_ routines to be loaded into macrospace "
  51.   exit
  52. end
  53.  
  54. signal on error name no_macro           /* which macro */
  55. signal on syntax name no_macro
  56. gotit=0
  57. flist=sref_list_infiles()
  58. gotit=1
  59. no_macro:
  60.  
  61. signal off error ; signal off syntax ;
  62. if gotit=0 then do               /* no sref routines */
  63.    say  ' Iter# ' iters ' of ' maxiters ' ( no sref routines loaded, will try again in ' sleepsec ' seconds '
  64.    call syssleep sleepsec
  65.    signal tryme1
  66. end  /* Do */
  67.  
  68. interpret flist
  69. TEMPDIR=directory()
  70.  
  71. /*
  72. say " Input files are: "
  73. say initfilt_file
  74. say repstrgs_file
  75. say alias_file
  76. say access_file
  77. say user_file
  78. say interpret_file
  79. say virtual_file
  80. SAY TEMPDIR
  81. */
  82.  
  83. say " Checking/updating macrospace ... "
  84. do mm=1 to 7
  85.    a1=strip(word(typlist,mm))
  86.    A=SREF_LOAD_MAC(tempdir,user_File,initfilt_file,repstrgs_File,  ,
  87.       alias_file,interpret_file,virtual_file,access_file,a1)
  88.  
  89. /* Not needed, load_mac will say something
  90.    if a=1 then
  91.        say " Updated: " a1
  92. */
  93.  
  94. end
  95.  
  96.  
  97. say " Sleeping for " sleepsec " seconds "
  98. call syssleep sleepsec
  99. iters=0
  100. signal tryme1
  101. exit
  102.